From 0f7be536edc7c64d5fe0c0b90cf7521fd5741d40 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 13 Aug 2006 21:40:35 +0000 Subject: [PATCH] Fix crash of certain D108 Garmins when writing routes. --- garmin.c | 6 ++++++ jeeps/gpsapp.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/garmin.c b/garmin.c index 054c9c28e..4698f7d7f 100644 --- a/garmin.c +++ b/garmin.c @@ -705,6 +705,12 @@ route_waypt_pr(const waypoint *wpt) if (wpt->altitude != unknown_alt) { rte->alt = wpt->altitude; } + if (wpt->altitude != unknown_alt) { + rte->alt = wpt->altitude; + } else { + rte->alt_is_unknown = 1; + rte->alt = 0; + } strncpy(rte->ident, wpt->shortname, sizeof(rte->ident)); rte->ident[sizeof(rte->ident)-1] = 0; diff --git a/jeeps/gpsapp.c b/jeeps/gpsapp.c index 204d198b9..104f535c7 100644 --- a/jeeps/gpsapp.c +++ b/jeeps/gpsapp.c @@ -2063,7 +2063,11 @@ static void GPS_D108_Send(UC *data, GPS_PWay way, int32 *len) GPS_Util_Put_Int(p,(int32)GPS_Math_Deg_To_Semi(way->lon)); p+=sizeof(int32); - GPS_Util_Put_Float(p,way->alt); + if (way->alt_is_unknown) { + GPS_Util_Put_Float(p,(const float) 1.0e25); + } else { + GPS_Util_Put_Float(p,way->alt); + } p+=sizeof(float); GPS_Util_Put_Float(p,way->dpth); p+=sizeof(float); -- 2.30.2